package com.yjhh.tilemap.repositories;

import com.yjhh.tilemap.domain.MapMarkInfo;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface MapMarkInfoRepository extends PagingAndSortingRepository<MapMarkInfo, Integer> {

    @Query(value = "select A from MapMarkInfo A where A.minLng<=?1 and A.minLat<=?2 and A.maxLng>=?1 and A.maxLat>=?2")
    List<MapMarkInfo> findMapMarkInfoByArea(Double lng, Double Lat);

    @Query(value = "select A from MapMarkInfo A where A.minLng>=?1 and A.minLat>=?2 and A.maxLng<=?3 and A.maxLat<=?4")
    List<MapMarkInfo> findMapMarkInfoByArea(double minLng, double minLat, double maxLng, double maxLat);

}
